<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript">
    function del(id){
        $.post("/applybuy/delRemitInfo",{id:id},function(data){
            if(data.code)
            {
                location.reload();
            }else{
                alert(data.msg);return false;
            }
        },"json");
    }
    //更改打款状态
    function remit(id,flag){
        if(flag == 0){
            $("#id").val(id);
            $("#showmabangorder").show();
        }
        if(flag == 1){
            var money = $("#goods_num").val();
            var id = $("#id").val();
            if(!money){
                alert("请输入打款金额!");return false;
            }
            $.post("/applybuy/ajaxbutton",{"op":"updRemitStatus","id":id,"money":money},function(data){
                if(data.code)
                {
                    location.reload();
                }else{
                    alert(data.msg);return false;
                }
            },"json");
        }


    }
    //更改打款状态
    function finddetails(id){

        var url = "/applybuy/ajaxbutton?op=findRemitDetails&id="+id;
        location.href = url;
    }
</script>
<title>财务查查看打款信息</title>
<body class="withvernav">
<div class="bodywrapper">
    {{include file='/public/leftmenu.tpl'}}
    <div class="centercontent">
        <div class="pageheader notab">
            <h1 class="pagetitle">财务查看打款信息</h1>
            <span class="pagedesc"></span>
        </div>
        <!--pageheader-->
        <div id="contentwrapper" class="contentwrapper">
            <div id="basicform" class="subcontent">
                <!--搜索栏-->
                <div>
                    <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
                </div>
                <form class="stdform stdform2" method="get" id="search" action="/applybuy/applyRemitList">
                    <div class="tableoptions">
                        名称：
                        <input type="text" name="name" id="name" class="width200" value="{{$name}}" placeholder="请输入名称" style="width:120px;"/>
                        <button class="btn btn_orange btn_search radius50">查询</button>
                    </div>
                </form>
                <!--搜索栏结束-->
                <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
                    <thead>
                    <tr class="lbbt">
                        <td  bgcolor="#FEFFF1">序号</td>
                        <td  bgcolor="#FEFFF1">名称</td>
                        <td  bgcolor="#FEFFF1">工厂</td>
                        <td  bgcolor="#FEFFF1">需要打款金额</td>
                        <td  bgcolor="#FEFFF1">真实打款金额</td>
                        <td  bgcolor="#FEFFF1">状态</td>
                        <td  bgcolor="#FEFFF1">操作</td>
                    </tr>
                    </thead>
                    <tbody >
                    {{foreach from=$orderlist item=li key=key}}
                    <tr>
                        <td valign="middle"  style="position:relative;">
                            {{$li.id}}
                        </td>
                        <td valign="middle" bgcolor="#FFFFFF">
                            {{$li.name}}
                        </td>
                        <td valign="middle" bgcolor="#FFFFFF">
                            {{$li.factory_name}}
                        </td>
                        <td valign="middle" bgcolor="#FFFFFF">
                            {{$li.allprice}}
                        </td>
                        <td valign="middle" bgcolor="#FFFFFF">
                            {{$li.trueprice}}
                        </td>
                        <td valign="middle" bgcolor="#FFFFFF">
                            {{if $li.status eq 1}}
                             未打款
                            {{elseif $li.status eq 2}}
                            已打款
                            {{else}}
                            {{/if}}
                        </td>
                        <td bgcolor="#FFFFFF" class="cz">
                            {{if $li.status eq 1}}
                            <a href="javascript:void(0)" onclick="remit({{$li.id}},0)">确认打款</a>
                            <a href="javascript:void(0)" onclick="del({{$li.id}})">删除</a>
                            <a href="javascript:void(0)" onclick="finddetails({{$li.id}})">查看明细</a>
                            {{elseif $li.status eq 2}}
                            <a href="javascript:void(0)" onclick="finddetails({{$li.id}})">查看明细</a>
                            {{else}}
                            {{/if}}


                        </td>
                    </tr>
                    {{/foreach}}
                    </tbody>
                </table>
                <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
            </div>
        </div>
</body>
<!-- 模态框（Modal）添加支出 -->
<form  method="post">
    <input type="hidden" name="editid" id="editid">
    <div class="modal fade" id="showmabangorder" tabindex="-1" role="dialog" aria-labelledby="sshowmabangorder" aria-hidden="true">
        <div class="modal-dialog" style="width:740px;top:160px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true" onclick="$('#showmabangorder').hide();">× </button>
                    <h4 class="modal-title" id="sshowmabangorder"> 添加真实打款金额 </h4>
                </div>
                <div class="modal-body">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td align="right">真实打款金额： </td>
                            <td align="left">
                                <input type="hidden" name="id" id="id" value="" maxlength="200" style="width:100px;line-height:0.4;" class="small_input" />
                                <input type="text" name="goods_num" id="goods_num" value="" maxlength="200" style="width:100px;line-height:0.4;" class="small_input" /> <font color="#FF0000">(*必填项)</font>
                            </td>
                        </tr>
                        <tr>
                    </table>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" onclick="$('#showmabangorder').hide();"> 关闭 </button>
                        <button type="button" class="btn btn-primary"  onclick="remit(0,1)"> 提交 </button>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
    </div>
    <!-- /.modal -->
</form>
</html>